﻿<UserControl x:Class="SH.Client.WPF.DesignData.SearchBar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:vm="clr-namespace:SH.Data.View.ViewModel;assembly=SH.Data.View"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance {x:Type vm:MainWindowViewModel}}" 
             Width="600" Height="45"
             >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="25" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="110" />
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="140"/>
            <ColumnDefinition Width="140"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="Реєстраційний №" HorizontalAlignment="Center" />
        <TextBox Grid.Row="1" Grid.Column="0" Width="110" >
            <TextBox.Text>
                <Binding Path="Search.Id" >
                    <Binding.ValidationRules>
                        <DataErrorValidationRule></DataErrorValidationRule>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>

        <TextBlock Grid.Row="0" Grid.Column="1" Text="Код ЄДРПОУ" HorizontalAlignment="Center" />
        <TextBox Grid.Row="1" Grid.Column="1" Width="100"
                 Text="{Binding Path=Search.Edrpou, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, NotifyOnValidationError=True}" >
        </TextBox>

        <TextBlock Grid.Row="0" Grid.Column="2" Text="Назва" HorizontalAlignment="Center" />
        <TextBox Grid.Row="1" Grid.Column="2" Width="140" 
                 Text="{Binding Path=Search.Name, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, NotifyOnValidationError=True}" ></TextBox>

        <TextBlock Grid.Row="0" Grid.Column="3" Text="Область" HorizontalAlignment="Center" />
        <ComboBox Grid.Row="1" Grid.Column="3"  Width="140"
                  ItemsSource="{Binding Path=Regions}" 
                  DisplayMemberPath="Name" SelectedItem="{Binding Path=Search.Region, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>

        <Button x:Name="Search" Content="Пошук" Grid.RowSpan="2" Grid.Column="4" Width="75" Height="35" Command="{Binding Search.SearchExecute}" HorizontalAlignment="Right" />
    </Grid>
</UserControl>
